<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
    $(document).ready(function(){
        $("#check_all").click(function(){
            $('input:checkbox').not(this).prop('checked', this.checked);
        });



    });
</script>
<form method="post" action="<?php echo base_url(); ?>admincp/comment/checkShow">
<table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
    <thead>
    <tr>
        <th>STT</th>
        <th>Product_name</th>
        <th>User_name</th>
        <th>User_email</th>
        <th>Title</th>
        <th>Description</th>
        <th>Date</th>
        <th>Action</th>
        <th>Function</th>
        <th><input type="checkbox" class="check_comment" name="check_all" id="check_all"></th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <?php if($comment != NULL){ ?>
        <?php $i=1; foreach($comment as $data){ ?>

        <td><?php echo $i; ?></td>
        <td class="center"><?php foreach ($nameproduct as $name) { ?>
                <?php if ($data['product_id'] == $name['product_id']) { ?>
                    <?php $b =  str_split($name['product_name'],10);
                    print_r($b[0]."...") ;
                    ?>
                <?php } ?> <?php } ?></td>
        <td class="center"><?php echo $data['comment_user_name']; ?></td>
        <td class="center"><?php $b =  str_split($data['comment_user_email'],10);
            print_r($b[0]."...") ;
            ?></td>
        <td class="center"><?php $b =  str_split($data['comment_title'],10);
            print_r($b[0]."...") ;
            ?></td>
        <td class="center"><?php $b =  str_split($data['comment_description'],10);
            print_r($b[0]."...") ;
            ?></td>
        <td class="center"><?php $b =  str_split($data['comment_date'],10);
            print_r($b[0]."...") ;
            ?></td>
        <td class="center" style="text-align: center"><?php if($data['comment_show'] == 1){ echo "Có";}else{ echo "Không";} ?></td>
        <td class="center">
            <a class="btn btn-success" href="<?php echo base_url()?>admincp/comment/detail/<?php echo $data['comment_id'] ?>">
                <i class="glyphicon glyphicon-zoom-in icon-white"></i>
                View
            </a>
            <a class="btn btn-danger" href="<?php echo base_url()?>admincp/comment/deleteComment/<?php echo $data['comment_id'] ?>">
                <i class="glyphicon glyphicon-trash icon-white"></i>
                Delete
            </a>
            <td style="text-align: center"><input type="checkbox" class="check_comment" name="check[]" value="<?php echo $data['comment_id']; ?>"></td>
        </td>
    </tr>
<?php $i++; } } ?>
    </tbody>
</table>
<div class="pagination-list"><?php echo $this->pagination->create_links(); ?></div>
    <div class="clear"></div>
    <div><input type="submit" id="show" class="show" name="show" value="Show/Hide"></div>
      <div><input type="submit" class="delete" name="delete" value="Delete"></div>

</form>